package com.hzdesk.media.koreabatchmatvector.logic.view;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hzdesk.media.koreabatchmatvector.R;
import com.hzdesk.media.koreabatchmatvector.logic.contract.OptionContract;
import com.hzdesk.media.koreabatchmatvector.logic.persenter.OptionPersenter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/7/7.
 */

public class OptionActivity extends BaseActivity implements OptionContract.IOptionView {
    @BindView(R.id.fragment_option_tv_title)
    TextView fragmentOptionTvTitle;
    @BindView(R.id.fragment_option_recyclerview)
    RecyclerView fragmentOptionRecyclerview;
    @BindView(R.id.activity_option_rl_bg)
    RelativeLayout activityOptionRlBg;


    private OptionPersenter optionPersenter = new OptionPersenter(this);

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_option);
        ButterKnife.bind(this);
        optionPersenter.initView(this, getIntent(), fragmentOptionRecyclerview);
    }

    @OnClick({R.id.fragment_option_tv_title, R.id.fragment_option_recyclerview})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.fragment_option_tv_title:
                break;
            case R.id.fragment_option_recyclerview:
                break;
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        finish();
    }

    @Override
    public void setTitle(String tiltle) {
        fragmentOptionTvTitle.setText(tiltle);
    }

    @Override
    public void back() {
        finish();

    }

    @Override
    protected void onStart() {
        super.onStart();
        final SharedPreferences mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
        int selector = mSharedPreferences.getInt("item_skin", 0); //todo 名称
        activityOptionRlBg.setBackgroundResource(updateBg[selector]);
    }
}
